
package vn.com.aptech.msh.utils;

import java.io.IOException;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author trietto
 */
public class NavigationHelper {
    public static String toSuccessPage(String from) {
        return "success?faces-redirect=true&from=" + from;
    }

    public static String toAdvertiseSuccessPage(int id) {
        return "success_advertise?faces-redirect=true&adv=" + id;
    }

    public static void sendHttpStatus(FacesContext ctx, int code) throws IOException {
        HttpServletResponse response = (HttpServletResponse) ctx.getExternalContext().getResponse();
        response.sendError(code);
    }
}
